<?php
echo $javascript->codeBlock("
	$(document).ready(function(){
		copyDelivery($('#CustomerDeliveryAsBilling').attr('checked'));
		$('#CustomerDeliveryAsBilling').bind('change', function (event) {
			copyDelivery($(this).attr('checked'));
		});
	});
	
	function copyDelivery(checked){
		if(checked){
			$('#CustomerDeliveryName').attr('value',$('#CustomerName').attr('value'));
			$('#CustomerDeliverySurname').attr('value',$('#CustomerSurname').attr('value'));
			$('#CustomerDeliveryAddress1').attr('value',$('#CustomerAddress1').attr('value'));
			$('#CustomerDeliveryAddress2').attr('value',$('#CustomerAddress2').attr('value'));
			$('#CustomerDeliveryAddress3').attr('value',$('#CustomerAddress3').attr('value'));
			$('#CustomerDeliveryAddress4').attr('value',$('#CustomerAddress4').attr('value'));
			$('#CustomerDeliveryAddress5').attr('value',$('#CustomerAddress5').attr('value'));
		}else{
			$('#CustomerDeliveryName').attr('value','');
			$('#CustomerDeliverySurname').attr('value','');
			$('#CustomerDeliveryAddress1').attr('value','');
			$('#CustomerDeliveryAddress2').attr('value','');
			$('#CustomerDeliveryAddress3').attr('value','');
			$('#CustomerDeliveryAddress4').attr('value','');
			$('#CustomerDeliveryAddress5').attr('value','');
		}
		
	}
",$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));
?>

<?php echo $this->Html->script(array('actions','users.view'),$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));?>
<?php echo $this->Html->css(array('users.register','form','actions'),null,array('inline'=>false));?>

<div id="left-panel">
	<div id="logo"><?php echo $this->Html->link($this->Html->image('logo.png'),'/',array('escape'=>false,'alt'=>'strzyzowianin.pl'))?></div>

	<ul>
		<?php echo $this->element('menu-main')?>
	</ul>
	
</div>
<div id="right-panel">

		<table width="100%" style="padding-top:0px; margin: 0px;" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="2" align="left"><h2><?php echo __('Rejestracja',true)?></h2></td>
			</tr>
			<tr>
				<td align="left" valign="top" style="padding-top:0px; margin: 0px;" width="50%">
					<?php echo $this->Form->create('User',array('url'=>array('plugin'=>false,'controller'=>'users','action'=>'register')));?>
					<table cellpadding="0" cellspacing="0">
						<tr>
							<td align="left" valign="top" style="padding-top:0px; margin: 0px;">
								<h4><?php __("Dane kontaktowe"); ?></h4>
								<?php
									echo $this->Form->input('email',array('label'=>__("E-mail",true),'style'=>'width: 200px;','class'=>'wymagane'));
									
									echo $this->Form->input('password',array('label'=>__("Hasło",true),'style'=>'width: 200px;','class'=>'wymagane'));
									echo $this->Form->input('repeat_password',array('type'=>'password','label'=>__("Powtórz hasło",true),'style'=>'width: 200px;','class'=>'wymagane'));	
									

									echo $this->Form->input('phone2',array('label'=>__("Telefon komórkowy",true),'style'=>'width: 200px;'));
										
									echo $this->Form->input('numer_referencyjny',array('label'=>__("Numer referencyjny",true),'after'=>__('Numer osoby która poleciła Ci nasz serwis.',true)));
									
// 									echo $html->image('/captcha/captcha/image', array('escape'=>false));
// 									echo $form->input('captcha', array('label' => false,'after'=>__('przepisz cyfry z obrazka',true)));
								?>
							</td>
	
							<td align="left" valign="top" style="padding-top:0px; margin: 0px; display: none;">
								<h4><?php __("Dane adresowe"); ?></h4>
								<?php
									echo $this->Form->input('first_name',array('label'=>__("Imię",true),'style'=>'width: 200px;'));
									echo $this->Form->input('last_name',array('label'=>__("Nazwisko",true),'style'=>'width: 200px;'));
									echo $this->Form->input('address1',array('label'=>__("Address",true),'style'=>'width: 200px;'));
									echo $this->Form->input('address2',array('label'=>__("Address",true),'style'=>'width: 200px;'));
									echo $this->Form->input('address3',array('label'=>__("City",true),'style'=>'width: 200px;'));
									echo $this->Form->input('address4',array('label'=>__("Zip Code",true)));
									echo $this->Country->selectbox('User.delivery_address5');
								?>
							</td>
							<td align="left" valign="top" style="padding-top:0px; margin: 0px; display: none;">										
								<h4><?php __('Dane do dostawy'); ?></h4>
							 		<div class="input text required">
										<label for="CustomerDeliveryAsBilling"><?php echo __("Same as Billing Details?",true);?></label>
										<?php 
										echo $this->Form->checkbox('delivery_as_billing',array('hiddenField' => false)); 
										$this->Js->get('#CustomerDeliveryAsBilling');
										$this->Js->event( 'change', 'copyDelivery($("#CustomerDeliveryAsBilling").attr("checked"));' ,true);
										?>	
									</div>
								<?php									
									echo $this->Form->input('delivery_name',array('label'=>__("First Name",true),'class'=>'delivery_files','style'=>'width: 200px;'));
									echo $this->Form->input('delivery_surname',array('label'=>__("Surname",true),'class'=>'delivery_files','style'=>'width: 200px;'));
									echo $this->Form->input('delivery_address1',array('label'=>__("Address",true),'class'=>'delivery_files','style'=>'width: 200px;'));
									echo $this->Form->input('delivery_address2',array('label'=>__("Address",true),'class'=>'delivery_files','style'=>'width: 200px;'));
									echo $this->Form->input('delivery_address3',array('label'=>__("City",true),'class'=>'delivery_files','style'=>'width: 200px;'));
									echo $this->Form->input('delivery_address4',array('label'=>__("Zip Code",true),'class'=>'delivery_files','style'=>'width: 200px;'));
									echo $this->Country->selectbox('User.delivery_address5');
								?>
							</td>
						</tr>
					</table>
					
					<?php echo $this->Form->end(__('Zapisz',true));?>
				</td>
			</tr>
		</table>
		<div class="clear"></div>
</div>
<div class="clear"></div>